home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow_WinXP / VideoControl / CPP / CompositeControl.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  5.0 KB  |  138 lines

  1. //------------------------------------------------------------------------------
  2. // File: CompositeControl.h
  3. //
  4. // Desc: Declaration of the CCompositeControl
  5. //       for the Windows XP MSVidCtl C++ sample
  6. //
  7. // Copyright (c) 2001 Microsoft Corporation.  All rights reserved.
  8. //------------------------------------------------------------------------------
  9.  
  10. #ifndef __COMPOSITECONTROL_H_
  11. #define __COMPOSITECONTROL_H_
  12.  
  13. #include "resource.h"       // main symbols
  14.  
  15. #include <atlctl.h>
  16. #include <msvidctl.h>
  17.  
  18. #pragma warning(disable:4100)  /* Disable 'unused parameter' warning */
  19.  
  20. #define SAFE_RELEASE(x) { if (x) { (x)->Release();  x=NULL; }}
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CCompositeControl
  24. class ATL_NO_VTABLE CCompositeControl : 
  25.     public CComObjectRootEx<CComSingleThreadModel>,
  26.     public IDispatchImpl<ICompositeControl, &IID_ICompositeControl, &LIBID_CPPVIDEOCONTROLLib>,
  27.     public CComCompositeControl<CCompositeControl>,
  28.     public IPersistStreamInitImpl<CCompositeControl>,
  29.     public IOleControlImpl<CCompositeControl>,
  30.     public IOleObjectImpl<CCompositeControl>,
  31.     public IOleInPlaceActiveObjectImpl<CCompositeControl>,
  32.     public IViewObjectExImpl<CCompositeControl>,
  33.     public IOleInPlaceObjectWindowlessImpl<CCompositeControl>,
  34.     public IPersistStorageImpl<CCompositeControl>,
  35.     public ISpecifyPropertyPagesImpl<CCompositeControl>,
  36.     public IQuickActivateImpl<CCompositeControl>,
  37.     public IDataObjectImpl<CCompositeControl>,
  38.     public IProvideClassInfo2Impl<&CLSID_CompositeControl, NULL, &LIBID_CPPVIDEOCONTROLLib>,
  39.     public CComCoClass<CCompositeControl, &CLSID_CompositeControl>
  40. {
  41. public:
  42.     CCompositeControl()
  43.     {
  44.         m_bWindowOnly = TRUE;
  45.         CalcExtent(m_sizeExtent);
  46.  
  47.         // Initialize internal data
  48.         m_pTuningSpaceContainer = NULL;
  49.         m_pATSCTuningSpace = NULL;
  50.         m_pATSCLocator = NULL;
  51.         m_pMSVidCtl = NULL;
  52.         m_hwndChannelID = NULL;
  53.     }
  54.  
  55. DECLARE_REGISTRY_RESOURCEID(IDR_COMPOSITECONTROL)
  56.  
  57. DECLARE_PROTECT_FINAL_CONSTRUCT()
  58.  
  59. BEGIN_COM_MAP(CCompositeControl)
  60.     COM_INTERFACE_ENTRY(ICompositeControl)
  61.     COM_INTERFACE_ENTRY(IDispatch)
  62.     COM_INTERFACE_ENTRY(IViewObjectEx)
  63.     COM_INTERFACE_ENTRY(IViewObject2)
  64.     COM_INTERFACE_ENTRY(IViewObject)
  65.     COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  66.     COM_INTERFACE_ENTRY(IOleInPlaceObject)
  67.     COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  68.     COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  69.     COM_INTERFACE_ENTRY(IOleControl)
  70.     COM_INTERFACE_ENTRY(IOleObject)
  71.     COM_INTERFACE_ENTRY(IPersistStreamInit)
  72.     COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  73.     COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
  74.     COM_INTERFACE_ENTRY(IQuickActivate)
  75.     COM_INTERFACE_ENTRY(IPersistStorage)
  76.     COM_INTERFACE_ENTRY(IDataObject)
  77.     COM_INTERFACE_ENTRY(IProvideClassInfo)
  78.     COM_INTERFACE_ENTRY(IProvideClassInfo2)
  79. END_COM_MAP()
  80.  
  81. BEGIN_PROP_MAP(CCompositeControl)
  82.     PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  83.     PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  84. END_PROP_MAP()
  85.  
  86. BEGIN_MSG_MAP(CCompositeControl)
  87.     CHAIN_MSG_MAP(CComCompositeControl<CCompositeControl>)
  88.     MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  89.     COMMAND_HANDLER(IDC_CHANNELDOWN, BN_CLICKED, OnClickedChanneldown)
  90.     COMMAND_HANDLER(IDC_CHANNELUP, BN_CLICKED, OnClickedChannelup)
  91.     COMMAND_ID_HANDLER(WM_CLOSE, OnExit)
  92.     MESSAGE_HANDLER(WM_SYSCOMMAND, OnSysCommand)
  93. END_MSG_MAP()
  94.  
  95. // Handler prototypes:
  96.     LRESULT OnExit(WORD /*wNotifyCode*/, WORD /* wID */, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  97.     LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  98. //  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  99. //  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  100. //  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  101.  
  102. BEGIN_SINK_MAP(CCompositeControl)
  103.     //Make sure the Event Handlers have __stdcall calling convention
  104. END_SINK_MAP()
  105.  
  106.     STDMETHOD(OnAmbientPropertyChange)(DISPID dispid)
  107.     {
  108.         if (dispid == DISPID_AMBIENT_BACKCOLOR)
  109.         {
  110.             SetBackgroundColorFromAmbient();
  111.             FireViewChange();
  112.         }
  113.         return IOleControlImpl<CCompositeControl>::OnAmbientPropertyChange(dispid);
  114.     }
  115.  
  116.  
  117. // IViewObjectEx
  118.     DECLARE_VIEW_STATUS(0)
  119.  
  120. // ICompositeControl
  121. public:
  122.  
  123.     enum { IDD = IDD_COMPOSITECONTROL };
  124.     IMSVidCtl * m_pMSVidCtl;
  125.     ITuningSpaceContainer * m_pTuningSpaceContainer;
  126.     IATSCTuningSpace * m_pATSCTuningSpace;
  127.     IATSCLocator * m_pATSCLocator;
  128.     HWND m_hwndChannelID;
  129.     
  130.     LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  131.     LRESULT OnClickedChannelup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  132.     LRESULT OnClickedChanneldown(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  133.     HRESULT SetChannel(long lChannel);
  134.     void ShowChannelNumber(long lChannel);
  135.     
  136. };
  137. #endif //__COMPOSITECONTROL_H_
  138.